package com.sjzxywlkj.cplife.alipay.conn;

import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.request.AlipayEcoCplifeRoominfoDeleteRequest;
import com.alipay.api.request.AlipayEcoCplifeRoominfoQueryRequest;
import com.alipay.api.request.AlipayEcoCplifeRoominfoUploadRequest;
import com.alipay.api.response.AlipayEcoCplifeRoominfoDeleteResponse;
import com.alipay.api.response.AlipayEcoCplifeRoominfoQueryResponse;
import com.alipay.api.response.AlipayEcoCplifeRoominfoUploadResponse;
import com.sjzxywlkj.cplife.alipay.config.AlipayConfig;
import com.sjzxywlkj.cplife.alipay.request.entity.RoominfoDelete;
import com.sjzxywlkj.cplife.alipay.request.entity.RoominfoQuery;
import com.sjzxywlkj.cplife.alipay.request.entity.RoominfoUpload;

/**
 * 房屋操作
 */
public class RoominfoConn {

    //上传物业小区内部房屋信息
    public static AlipayEcoCplifeRoominfoUploadResponse upload(RoominfoUpload roominfoUpload, String app_auth_token) throws AlipayApiException {
        AlipayClient alipayClient = AlipayConfig.aClient();
        AlipayEcoCplifeRoominfoUploadRequest request = new AlipayEcoCplifeRoominfoUploadRequest();
        request.putOtherTextParam("app_auth_token", app_auth_token);
        request.setBizContent(roominfoUpload.toJson());
        AlipayEcoCplifeRoominfoUploadResponse response = alipayClient.execute(request);
        return response;
    }

    //删除物业小区房屋信息
    public static AlipayEcoCplifeRoominfoDeleteResponse delete(RoominfoDelete roominfoDelete, String app_auth_token) throws AlipayApiException {
        AlipayClient alipayClient = AlipayConfig.aClient();
        AlipayEcoCplifeRoominfoDeleteRequest request = new AlipayEcoCplifeRoominfoDeleteRequest();
        request.putOtherTextParam("app_auth_token", app_auth_token);
        request.setBizContent(roominfoDelete.toJson());
        AlipayEcoCplifeRoominfoDeleteResponse response = alipayClient.execute(request);
        return response;
    }

    //查询小区房屋信息列表
    public static AlipayEcoCplifeRoominfoQueryResponse query(RoominfoQuery roominfoQuery, String app_auth_token) throws AlipayApiException {
        AlipayClient alipayClient = AlipayConfig.aClient();
        AlipayEcoCplifeRoominfoQueryRequest request = new AlipayEcoCplifeRoominfoQueryRequest();
        request.putOtherTextParam("app_auth_token", app_auth_token);
        request.setBizContent(roominfoQuery.toJson());
        AlipayEcoCplifeRoominfoQueryResponse response = alipayClient.execute(request);
        return response;
    }
}
